import request from "@/utils/request"

export function getArticleList(params) {
  return request({
    url: "/article/list",
    method: "get",
    params
  })
}

export function getArticleDetail(id) {
  return request({
    url: `/article/${id}`,
    method: "get"
  })
}

export function getArticlesByCategory(categoryId) {
  return request({
    url: `/article/category/${categoryId}`,
    method: "get"
  })
}

export function createArticle(data) {
  return request({
    url: "/article",
    method: "post",
    data
  })
}

export function updateArticle(data) {
  return request({
    url: "/article",
    method: "put",
    data
  })
}

export function deleteArticle(id) {
  return request({
    url: `/article/${id}`,
    method: "delete"
  })
}
